package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpNewTicketPageUtil extends SeleniumPageUtil{
	public final static By NEW_TICKET_LBL_HEADER = By.id("IncidentHdr1_Header_lblHeader");
	public final static By NEW_TICKET_BUTTON_SAVE = By.xpath("//*[@id='badd6d10-5932-4bbc-b11c-c04a27fe36ac']/a");
	public final static By NEW_TICKET_LBL_CUSTOMER = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[2]/tbody/tr[1]/td[1]");
	public final static By NEW_TICKET_LBL_STATUS = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[2]/tbody/tr[1]/td[3]");
	public final static By NEW_TICKET_INPUT_STATUS = By.id("IncidentHdr1_txtStatus");
	public final static By NEW_TICKET_LBL_PROBLEM_DETAILS = By.id("IncidentHdr1_trNotes");
	public final static By NEW_TICKET_TEXTAREA_PROBLEM_DETAILS = By.id("IncidentHdr1_txtNotes");
	public final static By NEW_TICKET_LBL_INCIDNET_ID = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[2]/tbody/tr[2]/td[1]");
	public final static By NEW_TICKET_INPUT_INCIDENT_ID = By.id("IncidentHdr1_txtIncidentNum");
	public final static By NEW_TICKET_IMAGE_INCIDENT_ID = By.id("IncidentHdr1_imgK");
	public final static By NEW_TICKET_LBL_PROBLEM_SUMMARY = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[2]/tbody/tr[2]/td[3]");
	public final static By NEW_TICKET_INPUT_PROBLEM_SUMMARY = By.id("IncidentHdr1_txtDescription");
	public final static By NEW_TICKET_LBL_EXTERNAL_TICKET_ID = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[2]/tbody/tr[3]/td[1]");
	public final static By NEW_TICKET_INPUT_EXTERNAL_TICKET_ID = By.id("IncidentHdr1_txtExternalTicketID");
	public final static By NEW_TICKET_LBL_INCIDENT_PRIORITY = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[2]/tbody/tr[3]/td[3]");
	public final static By NEW_TICKET_SELECT_INCIDENT_PRIORITY = By.id("IncidentHdr1_cboPriorityCodeKey");
	public final static By NEW_TICKET_LBL_SRO_TYPE = By.xpath("//*[@id='IncidentHdr1_rowSmsOnlyToggle1']/td[3]");
	public final static By NEW_TICKET_SELECT_SRO_TYPE = By.id("IncidentHdr1_cboSroType");
	public final static By NEW_TICKET_LBL_INCIDENT_DATE_AND_TIME = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[2]/tbody/tr[5]/td[1]");
	public final static By NEW_TICKET_INPUT_INCIDENT_DATE = By.id("IncidentHdr1_txtIncidentDate");
	public final static By NEW_TICKET_INPUT_INCIDENT_TIME = By.id("IncidentHdr1_txtTime");
	public final static By NEW_TICKET_LBL_FOLLOW_UP_TIME = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[2]/tbody/tr[5]/td[3]");
	public final static By NEW_TICKET_INPUT_FOLLOW_UP_TIME = By.id("IncidentHdr1_txtFollowUp");
	public final static By NEW_TICKET_CREATOR_AND_PHONE = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[2]/tbody/tr[6]/td[1]");
	public final static By NEW_TICKET_INPUT_CREATE_BY = By.id("IncidentHdr1_txtCreateBy");
	public final static By NEW_TICKET_INPUT_CREATOR_PHONE = By.id("IncidentHdr1_txtCreatorPhone");
	public final static By NEW_TICKET_LBL_SERVICE_PARTNER = By.id("IncidentHdr1_lblServicePartner");
	public final static By NEW_TICKET_INPUT_SERVICE_PARTNER = By.id("IncidentHdr1_txtPartner");
	public final static By NEW_TICKET_LBL_REQUESTER = By.xpath("//*[@id='IncidentHdr1_rowCustomerUnknownToggle1']/td[1]");
	public final static By NEW_TICKET_LINK_REQUESTER_EDIT = By.id("IncidentHdr1_btnRequesterEdit");
	public final static By NEW_TICKET_LINK_REQUESTER_NEW = By.id("IncidentHdr1_btnRequesterNew");
	public final static By NEW_TICKET_INPUT_REQUESTER = By.id("IncidentHdr1_txtRequester");
	public final static By NEW_TICKET_INPUT_REQUESTER_PHONE = By.id("IncidentHdr1_txtRequesterPhone");
	public final static By NEW_TICKET_LBL_CONTRACT_AND_LINE = By.xpath("//*[@id='IncidentHdr1_rowCustomerUnknownToggle1']/td[3]");
	public final static By NEW_TICKET_SPAN_CONTRACT_LINE = By.id("IncidentHdr1_lblContractLineDisplay");
	public final static By NEW_TICKET_LBL_PO_CONTRACT = By.xpath("//*[@id='IncidentHdr1_rowCustomerUnknownToggle2']/td[1]");
	public final static By NEW_TICKET_LINK_PO_CONTRACT_EDIT = By.id("IncidentHdr1_btnContactEdit");
	public final static By NEW_TICKET_LINK_PO_CONTRACT_NEW = By.id("IncidentHdr1_btnContactNew");
	public final static By NEW_TICKET_INPUT_PO_CONTRACT = By.id("IncidentHdr1_txtPointOfContact");
	public final static By NEW_TICKET_INPUT_PO_CONTRACT_PHONE = By.id("IncidentHdr1_txtContactPhone");
	public final static By NEW_TICKET_LBL_SLA_TERMS = By.xpath("//*[@id='IncidentHdr1_rowCustomerUnknownToggle2']/td[3]");
	public final static By NEW_TICKET_LBL_ASSIGNED_TO_PHONE = By.id("IncidentHdr1_pnlAssignedToLbl");
	public final static By NEW_TICKET_LINK_ASSIGNED_TO_NOTIFY = By.id("IncidentHdr1_btnNotify");
	public final static By NEW_TICKET_INPUT_ASSIGNED_TO = By.id("IncidentHdr1_txtAssignedTo");
	public final static By NEW_TICKET_INPUT_ASSIGNED_TO_PHONE = By.id("IncidentHdr1_txtAssignedToPhone");
	public final static By NEW_TICKET_IMAGE_CLEAR_ASSIGNMENT = By.id("IncidentHdr1_imgClearAssignment");
	public final static By NEW_TICKET_LBL_RCA = By.id("IncidentHdr1_lblRCAFlag");
	public final static By NEW_TICKET_CHECKBOX_RCA = By.id("IncidentHdr1_chkRCAFlag");
	
	public final static By NEW_TICKET_LBL_ASSET = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[3]/tbody/tr/td[1]/table/tbody/tr[1]/td[1]");
	public final static By NEW_TICKET_BUTTON_SEARCH_ASSET = By.id("IncidentAsset1_btnAsset");
	// red * of asset
	public final static By NEW_TICKET_LBL_ASSET_ASTERISK = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/table[3]/tbody/tr/td[1]/table/tbody/tr[1]/td[1]/span");
	
	
	public static void enterNewTicketPage(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterNewTicketPage();
	}
	
	public static void waitForPageToLoad() {
		// list page in content area
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				NEW_TICKET_BUTTON_SAVE, NEW_TICKET_IMAGE_INCIDENT_ID, NEW_TICKET_SELECT_INCIDENT_PRIORITY, NEW_TICKET_IMAGE_CLEAR_ASSIGNMENT, NEW_TICKET_BUTTON_SEARCH_ASSET 
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(NEW_TICKET_BUTTON_SAVE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(NEW_TICKET_IMAGE_INCIDENT_ID));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(NEW_TICKET_SELECT_INCIDENT_PRIORITY));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(NEW_TICKET_IMAGE_CLEAR_ASSIGNMENT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(NEW_TICKET_BUTTON_SEARCH_ASSET));
	}
}
